<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: ActionController::UTF8::InstanceMethods</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">ActionController::UTF8::InstanceMethods</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/utf8_plugin/lib/actioncontroller_utf8_rb.html">
                vendor/plugins/utf8_plugin/lib/actioncontroller_utf8.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000003">normalize_if_string</a>&nbsp;&nbsp;
      <a href="#M000002">normalize_params</a>&nbsp;&nbsp;
      <a href="#M000004">normalize_strings_in_hash</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000003" class="method-detail">
        <a name="M000003"></a>

        <div class="method-heading">
          <a href="#M000003" class="method-signature">
          <span class="method-name">normalize_if_string</span><span class="method-args">(str, form)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Normalizes <tt>str</tt> if str is an utf-8 encoded string
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000003-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/utf8_plugin/lib/actioncontroller_utf8.rb, line 59</span>
59:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">normalize_if_string</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">form</span>)
60:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">str</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">str</span>.<span class="ruby-identifier">is_utf8?</span>
61:           <span class="ruby-identifier">str</span>.<span class="ruby-identifier">chars</span>.<span class="ruby-identifier">normalize</span>(<span class="ruby-identifier">form</span>)
62:         <span class="ruby-keyword kw">else</span>
63:           <span class="ruby-identifier">str</span>
64:         <span class="ruby-keyword kw">end</span>
65:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000002" class="method-detail">
        <a name="M000002"></a>

        <div class="method-heading">
          <a href="#M000002" class="method-signature">
          <span class="method-name">normalize_params</span><span class="method-args">(form)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Normalizes all the strings in params. <tt>form</tt> should be on of the
four normalization forms or nil to do nothing. Normally you don&#8216;t
call this method directly, instead it&#8216;s used through
<tt>normalize_unicode_params</tt>.
</p>
<pre>
  class AccountController &lt; ActionController::Base
    normalize_unicode_params :form =&gt; :d
  end
</pre>
<p>
But you can also call it explicitly from an action.
</p>
<pre>
  class AccountController &lt; ActionController::Base
    def update
      normalize_params :d
    end
  end
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000002-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/utf8_plugin/lib/actioncontroller_utf8.rb, line 53</span>
53:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">normalize_params</span>(<span class="ruby-identifier">form</span>)
54:         <span class="ruby-identifier">normalize_strings_in_hash</span>(<span class="ruby-identifier">params</span>, <span class="ruby-identifier">form</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$KCODE</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'UTF8'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-operator">!</span><span class="ruby-identifier">form</span>.<span class="ruby-identifier">nil?</span>
55:         <span class="ruby-keyword kw">true</span>
56:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000004" class="method-detail">
        <a name="M000004"></a>

        <div class="method-heading">
          <a href="#M000004" class="method-signature">
          <span class="method-name">normalize_strings_in_hash</span><span class="method-args">(h, form)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Normalizes the utf-8 encoded strings in the hash
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000004-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/utf8_plugin/lib/actioncontroller_utf8.rb, line 68</span>
68:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">normalize_strings_in_hash</span>(<span class="ruby-identifier">h</span>, <span class="ruby-identifier">form</span>)
69:         <span class="ruby-identifier">h</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
70:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
71:             <span class="ruby-identifier">normalize_strings_in_hash</span>(<span class="ruby-identifier">v</span>, <span class="ruby-identifier">form</span>)
72:           <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
73:             <span class="ruby-identifier">v</span>.<span class="ruby-identifier">map!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">normalize_if_string</span>(<span class="ruby-identifier">i</span>, <span class="ruby-identifier">form</span>) }
74:           <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
75:             <span class="ruby-identifier">v</span>.<span class="ruby-identifier">replace</span> <span class="ruby-identifier">normalize_if_string</span>(<span class="ruby-identifier">v</span>, <span class="ruby-identifier">form</span>)
76:           <span class="ruby-keyword kw">end</span>
77:         <span class="ruby-keyword kw">end</span>
78:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>